#ifndef FILEVIEW_H
#define FILEVIEW_H

#include <QTreeWidget>
#include <QDebug>
#include <QFileInfo>
#include <QHeaderView>
#include <QFileDialog>
#include <QTreeWidgetItem>
#include <QFileInfo>
#include <QCoreApplication>
#include <QMessageBox>
#include <QColor>
#include <QList>
#include "UpdateFile.h"

 class FileView : public QTreeWidget
{
	Q_OBJECT
	
public:
	FileView( QWidget* parent = 0 );
	virtual ~FileView();
	void SetLevelSelectedFiles(int lvl);
	QList<UpdateFile*> getList();
	void Set_Path_Updater(QString NewPath);
	void Insert_updater(QString Path, QString FileName, int priority);
public slots:
	void AddFile();                     //Add file with their absolute path
	void AddFolder();                   //Add file recursivly with their absolute path
	void DeleteSelectedFile();          //Delete file in the list
	void setFilelevel(int new_val);     //Set the default Filelevel
	void setCheckDoublon(bool new_val); //Set the value of CheckDoublon
	void setfloodMsgBox(bool new_val);  //Set the value of floodMsgBox
	void InsertFileFromXML(QString Sha1, QString Path, QString FileName, int priority); //Insert line from XML
signals:
	void TaskToShowInStatusbar(QString msg); //Send a message to the mainwindow.
	void TaskToShowGbEdit(bool state);  //task to show the GroupBox Edit
	void TaskToEnableGUI(bool state);   //task to enable or disable controls
	void OneItemWasAdded();             //Emit when one item is ... added :)
private slots:
	void ItemsSelectedChange(); //Called when an item is selected (task to show the GroupBox Edit)
	void FloodMSg(QString msg); //Intercept the signal TaskToShowInStatusbar and show the msg in msgbox
private:
	void AddQTreeWidgetItem(QString filename, int level, QString AbsolutePath, QString sha1 = "");
	QFileInfoList getFiles(QDir fromDir, const QStringList& filters, bool recursive);
	int Filelevel;
	bool CheckDoublon;
	bool floodMsgBox;
	QString Path_Updater;
};

#endif // FILEVIEW_H
